import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { environment } from '@env/environment';
// layout
import { LayoutDefaultComponent } from '../layout/default/default.component';
import { LayoutFullScreenComponent } from '../layout/fullscreen/fullscreen.component';
import { LayoutPassportComponent } from '../layout/passport/passport.component';
// dashboard pages
import { DashboardV1Component } from './dashboard/v1/v1.component';
import { UserListComponent } from './user/user-list.component';
import { DeptListComponent } from './dept/dept-list.component';
// passport pages
import { UserLoginComponent } from './passport/login/login.component';

import { AuthGuardService } from '../core/services/auth-guard.service';

const routes: Routes = [
    {
        path: '',
        component: LayoutDefaultComponent,
        children: [
            { path: '', redirectTo: 'dashboard/v1', pathMatch: 'full' },

            { path: 'dashboard/v1', component: DashboardV1Component, data: { translate: 'dashboard_v1' } ,canActivate: [AuthGuardService] },
            { path: 'user/list', component: UserListComponent, canActivate: [AuthGuardService] },
            { path: 'dept/list', component: DeptListComponent, canActivate: [AuthGuardService] },

        ]
    },
    // passport
    {
        path: 'passport',
        component: LayoutPassportComponent,
        children: [
            { path: 'login', component: UserLoginComponent },

        ]
    },
];

@NgModule({
    imports: [RouterModule.forRoot(routes, { useHash: environment.useHash })],
    exports: [RouterModule]
})
export class RouteRoutingModule { }
